
/********************************** LICENSE ************************************
 *
 * Copyright 2011 Alessandro Carrega
 * email: alessandro.carrega@unige.it
 *
 * This file is part of simulation_time.
 *
 * simulation_time is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * simulation_time is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with simulation_time.  If not, see <http://www.gnu.org/licenses/>.
 *
 ********************************* LICENSE ************************************/

//SimulationTime.h
//Definizione di un nuovo tipo per il tempo di simulazione.

#ifndef SIMULATION_TIME_HPP_
#define SIMULATION_TIME_HPP_

#include <iostream>

#define NANO 1 // TODO Set NANO define

class SimulationTime
{
private:
	double second, nanoSecond;

	void build(double, double);

public:
	SimulationTime();
	SimulationTime(double, double);
	SimulationTime(int, int);
	SimulationTime(double);
	SimulationTime(const SimulationTime&);
	double getSecond() const;
	double getNanoSecond() const;
	friend void operator<<(std::ostream&, SimulationTime);
	friend bool operator<(SimulationTime, SimulationTime);
	friend bool operator>(SimulationTime, SimulationTime);
	friend bool operator==(SimulationTime, SimulationTime);
	friend bool operator<=(SimulationTime, SimulationTime);
	friend bool operator>=(SimulationTime, SimulationTime);
	friend SimulationTime operator+(SimulationTime, SimulationTime);
	//friend SimulationTime operator*(SimulationTime, SimulationTime);
	friend SimulationTime operator*(SimulationTime, double);
	SimulationTime& operator+=(SimulationTime);
	friend SimulationTime operator-(SimulationTime, SimulationTime);
	SimulationTime& operator-=(SimulationTime);
	operator double() const;
	char *toString() const;
};

#endif /* SIMULATION_TIME_HPP_ */
